package com.gugee.ins.common.dal.service.statistics.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gugee.ins.common.dal.mapper.statistics.InsStBrandMapper;
import com.gugee.ins.common.dal.service.statistics.InsStBrandDao;
import com.gugee.ins.common.model.es.brand.InsBrandEsMapping;
import com.gugee.ins.common.model.mysql.statistics.InsStBrand;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;


/**
 * InsStBrandDaoImpl
 * @author Huangxin
 */
@Slf4j
@Service
public class InsStBrandDaoImpl extends ServiceImpl<InsStBrandMapper, InsStBrand> implements InsStBrandDao {

    /**
     * 更新打点
     * @param bid
     * @param limitTimeStart
     * @param limitTimeEnd
     */
    @Override
    public void updateBrandSt(long bid, long limitTimeStart, long limitTimeEnd) {
        baseMapper.updateBrandSt(bid,limitTimeStart,limitTimeEnd,System.currentTimeMillis() / 1000);
    }

    /**
     * 判断是否存在
     * @param bid
     * @return
     */
    @Override
    public boolean findExist(long bid) {
        return baseMapper.findExist(bid) != null;
    }

    /**
     * 插入初始化的空数据
     * @param bid
     */
    @Override
    public void insertEmptyData(long bid) {
        baseMapper.insertEmptyData(bid,System.currentTimeMillis() / 1000);
    }

    @Override
    public InsBrandEsMapping findEsMappingByBid(long bid) {
        return baseMapper.findEsMappingByBid(bid);
    }
}
